package com.example.spring.multi.task;

import com.example.spring.multi.basic.dingdang.DDExcelDealStartUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.util.List;

/**
 * @program: knowledge-pooling
 * @ClassName DDExcelDealTask
 * @description: 叮当Excel处理任务
 * @author: tomato
 * @create: 2024-07-18 14:07
 * @Version 1.0
 **/
@Configuration
@EnableScheduling
@Slf4j
public class DDExcelDealTask {
    //每五分钟执行一次
    public static final int INTERVAL_TIME = 3 * 60 * 1000;
    //设置计数器
    private static int count = 0;
    //设置城市初始化集合 北京市、天津市、济南市、郑州市、西安市、上海市、杭州市、南京市、武汉市、深圳市、广州市、福州市、成都市、重庆市、北京药房网
//    private static List<String> cityNameList = List.of("北京市", "天津市", "济南市", "郑州市", "西安市", "上海市", "杭州市", "南京市", "武汉市", "深圳市", "广州市", "福州市", "成都市", "重庆市", "北京药房网");
    private static List<String> cityNameList = List.of("深圳市", "广州市", "福州市","郑州市");

//    @Scheduled(fixedRate = INTERVAL_TIME)
    public void execute() {
        log.info("叮当Excel处理任务开始执行计数器为：" + count + "，当前时间：" + System.currentTimeMillis());
        if (count > cityNameList.size()-1) {
            return;
        }
        DDExcelDealStartUtil.buildSignInDateModels(cityNameList.get(count));
        count++;
        log.info("叮当Excel处理任务执行完毕，计数器为：" + count + "，当前时间：" + System.currentTimeMillis());
    }
}
